# -*- coding: utf-8 -*-
# @Time:2021/04/18 15:29
# @Author:Cindy

from appium.webdriver.common.mobileby import MobileBy
from pages.add_member_page import AddMember
from pages.base_page import BasePage


class Contact(BasePage):

    def get_memberlist(self):
        """
        获取成员列表
        :return:
        """
        datas = self.driver.find_elements(MobileBy.CLASS_NAME, "android.widget.TextView")
        namelist = [data.text for data in datas]
        print(namelist)
        return namelist

    def goto_addmember(self):
        """
        点击“添加成员”按钮，返回添加成员实例对象
        :return:
        """
        self.driver.find_element(MobileBy.XPATH, "//*[@text='添加成员']").click()
        return AddMember(self.driver)
